package com.etone.smartAudit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etone.smartAudit.domain.IapDataModel;
import com.etone.smartAudit.enums.UseState;
import com.etone.smartAudit.vo.iapDataModel.IapDataModelBaseVO;
import com.etone.smartAudit.vo.iapDataModelNav.IapDataModelNavDetailVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author: sovy
 * @date: 2020/8/27
 * @description:
 */

@Mapper
public interface IapDataModelMapper extends BaseMapper<IapDataModel> {

    /**
     * 元数据导航查询
     *
     * @param senLevel 敏感性
     * @param level2 二级分类
     * @param keyword 关键字
     * @param dataAssertIds
     * @param dataMassIds
     * @param dimensionIds
     * @param autoTagIds
     * @param queryType
     * @return
     */
    List<IapDataModelNavDetailVO> listNav(@Param("level2") Integer level2, @Param("keyword") String keyword, @Param("senLevelIds") List<Integer> senLevelIds,
                                          @Param("dataAssertIds") List<Integer> dataAssertIds, @Param("dataMassIds") List<Integer> dataMassIds,
                                          @Param("dimensionIds") List<Integer> dimensionIds, @Param("autoTagIds") List<Integer> autoTagIds,
                                          @Param("queryType") String queryType);

    List<IapDataModelBaseVO> findList(@Param("iapPlatformName") String iapPlatformName, @Param("cnTableName") String cnTableName, @Param("enTableName") String enTableName, @Param("description") String description, @Param("level3Ids") List<Integer> level3Ids, @Param("databaseName") String databaseName, @Param("itemId") Integer itemId, @Param("useState") UseState useState,
                                      @Param("senLevel") Integer senLevel, @Param("dataPssA") Integer dataPssA, @Param("startTime") Date startTime, @Param("endTime") Date endTime,
                                      @Param("dataAssertIds") List<Integer> dataAssertIds, @Param("dataMassIds") List<Integer> dataMassIds, @Param("dimensionIds") List<Integer> dimensionIds,@Param("autoTagIds")  List<Integer> autoTagIds);

    List<IapDataModel> selectByIapPlatformId(@Param("iapPlatformId") Integer iapPlatformId);

    /**
     * 校验英文表名是否存在
     *
     * @param id
     * @param platformId
     * @param enTableName
     * @return
     */
    boolean checkEnTableNameExists(@Param("id") Integer id, @Param("platformId") Integer platformId, @Param("enTableName") String enTableName);

    /**
     * 校验中文表名是否存在
     *
     * @param id
     * @param platformId
     * @param cnTableName
     * @return
     */
    boolean checkCnTableNameExists(@Param("id") Integer id, @Param("platformId") Integer platformId, @Param("cnTableName") String cnTableName);
}